<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增点餐')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-order-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">菜品名称：</label>
                <div class="col-sm-8">
                    <select id="tzVagetables" class="form-control m-b">
						<option th:each="tzVagetables:${tzVagetabless}" th:value="${tzVagetables.vagetablesId}" th:text="${tzVagetables.vagetablesName}" ></option>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">用户名称：</label>
                <div class="col-sm-8">
                    <select id="sysUser" class="form-control m-b">
						<option th:each="sysUser:${sysUsers}" th:value="${sysUser.userId}" th:text="${sysUser.userName}" ></option>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">点餐时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="orderTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/order"
        $("#form-order-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
            	var data = $("#form-order-add").serializeArray();
        		var tzVagetablesId = $("#tzVagetables").val();
        		data.push({"name": "vagetablesId", "value": tzVagetablesId});
        		var sysUserId = $("#sysUser").val();
        		data.push({"name": "userId", "value": sysUserId});
        		$.operate.save(prefix + "/add", data);
            }
        }
        
        $("input[name='orderTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>